home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4158 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.0 KB

  1. Path: news.ucalgary.ca!news
  2. From: mvjohnso@acs.ucalgary.ca
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Q: how to handle currency?
  5. Date: 28 Jan 1996 15:23:04 GMT
  6. Organization: University of Calgary
  7. Message-ID: <4eg4co$eos@ds2.acs.ucalgary.ca>
  8. References: <4e93he$ec@sun.cis.smu.edu>
  9. Reply-To: mvjohnso@acs.ucalgary.ca
  10. NNTP-Posting-Host: @ts1-port-6.acs.ucalgary.ca
  11. X-Newsreader: IBM NewsReader/2 v1.2.5
  12.  
  13. In <4e93he$ec@sun.cis.smu.edu>, dbowman@post.smu.edu (Damon Bowman) writes:
  14. >
  15. >Another beginner question:
  16. >
  17. >What data type is used for currency when you want "precision as
  18. >displayed?"  When using the float or double data types, you run into
  19. >the problem of imprecision.  In other words, I want to actually round
  20. >off my numbers when necessary to create real amounts of EXACTLY 47.23,
  21. >or whatever the case may be.
  22. >
  23. >One of my books suggests that there is a method of doing this with
  24. >integers, but it does not go into any detail.
  25. >
  26. >Any assistance is appreciated.
  27. >
  28.  
  29. Look up something called Binary Coded Decimal (BCD), this should answer all 
  30. your questions.
  31.  
  32. Matt
  33.